// ManagerWhiteboard
//
// This class represents the whiteboard space for all clerks to report events to the manager.
// This will include when lines are getting long or short, and when the theater is full.
// It will be protected by a monitor and be maintained by all the clerks and read by the manager
// to make reports.
//

#include "ManagerWhiteboard.h"

// Initialize the ManagerWhiteboard object
ManagerWhiteboard::ManagerWhiteboard(int numTicket, int numFood, int numTaker) {
	movieRunning = false;
	numTicketClerks = numTicket;
	numFoodClerks = numFood;
	numTakerClerks = numTaker;

	ticketClerkStatus = new int[numTicket];
	ticketClerkLineStatus = new int[numTicket];
	foodClerkStatus = new int [numFood];
	foodClerkLineStatus = new int [numFood];
	takerClerkStatus = new int[numTaker];
	takerClerkLineStatus = new int[numTaker];
	takerClerkTheaterStatus = new int[numTaker];
	
	for (int i = 0; i < numTicket; i++) {
		ticketClerkStatus[i] = CLERK_NOMINAL;
		ticketClerkLineStatus[i] = CLERK_LINE_NORM;
	}
	
	for (int i = 0; i < numFood; i++) {
		foodClerkStatus[i] = CLERK_NOMINAL;
		foodClerkLineStatus[i] = CLERK_LINE_NORM;
	}
	
	for (int i = 0; i < numTaker; i++) {
		takerClerkStatus[i] = CLERK_NOMINAL;
		takerClerkLineStatus[i] = CLERK_LINE_NORM;
		takerClerkTheaterStatus[i] = TAKER_CLERK_TAKING_TICKETS;
	}
	
	//ticketClerkStatus[1] = CLERK_BREAK;
}
// De-allocate ManagerWhiteboard		
ManagerWhiteboard::~ManagerWhiteboard() {
	
}

// returns if a movie is currently running.
bool ManagerWhiteboard::isMovieRunning() {
	return movieRunning;
}

// returns the number of ticket clerks in the simulation
int ManagerWhiteboard::getNumTicketClerks() {
	return numTicketClerks;
}

// returns the number of food clerks in the simulation
int ManagerWhiteboard::getNumFoodClerks() {
	return numFoodClerks;
}

// returns the number of taker clerks in the simulation
int ManagerWhiteboard::getNumTakerClerks() {
	return numTakerClerks;
}

// returns current status of the given ticketClerk using the static constants
int ManagerWhiteboard::getTicketClerkStatus(int clerkID) {
	return ticketClerkStatus[clerkID];
}

// returns current status of the given ticketClerk line using the static constants
int ManagerWhiteboard::getTicketClerkLineStatus(int clerkID) {
	return ticketClerkLineStatus[clerkID];
}

// returns current status of the given ticketClerk using the static constants
int ManagerWhiteboard::getFoodClerkStatus(int clerkID) {
	return foodClerkStatus[clerkID];
}

// returns current status of the given ticketClerk line using the static constants
int ManagerWhiteboard::getFoodClerkLineStatus(int clerkID) {
	return foodClerkLineStatus[clerkID];
}

// returns current status of the given TakerClerk using the static constants
int ManagerWhiteboard::getTakerClerkStatus(int clerkID) {
	return takerClerkStatus[clerkID];
}

// returns current status of the given TakerClerk line using the static constants
int ManagerWhiteboard::getTakerClerkLineStatus(int clerkID) {
	return takerClerkLineStatus[clerkID];
}

// returns whether the taker clerk is letting people into the theater
int ManagerWhiteboard::getTakerClerkTheaterStatus(int clerkID) {
	return takerClerkTheaterStatus[clerkID];
}

// sets if a movie is currently running
void ManagerWhiteboard::setMovieRunning(bool movie) {
	movieRunning = movie;
}

// sets the ticketClerk status using one of the static constants
void ManagerWhiteboard::setTicketClerkStatus(int clerkID, int status) {
	ticketClerkStatus[clerkID] = status;
}

// sets the ticketClerk line status using one of the static constants
void ManagerWhiteboard::setTicketClerkLineStatus(int clerkID, int status) {
	ticketClerkLineStatus[clerkID] = status;
}

// sets the foodClerk status using one of the static constants
void ManagerWhiteboard::setFoodClerkStatus(int clerkID, int status) {
	foodClerkStatus[clerkID] = status;
}

// sets the foodClerk line status using one of the static constants
void ManagerWhiteboard::setFoodClerkLineStatus(int clerkID, int status) {
	foodClerkLineStatus[clerkID] = status;
}

// sets the takerClerk status using one of the static constants	
void ManagerWhiteboard::setTakerClerkStatus(int clerkID, int status) {
	takerClerkStatus[clerkID] = status;
}

// sets the takerClerk line status using one of the static constants	
void ManagerWhiteboard::setTakerClerkLineStatus(int clerkID, int status) {
	takerClerkLineStatus[clerkID] = status;
}

// sets the status of if this clerk is letting people into the theater or not		
void ManagerWhiteboard::setTakerClerkTheaterStatus(int clerkID, int status) {
	takerClerkTheaterStatus[clerkID] = status;
}
